/**
 * 
 */
package com.gragra.applications;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashSet;
/**
 * @author Christoph Teichmann
 * 02.09.2013
 */
public class NounPercentageByAll
{
	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException
	{
		BufferedReader input = new BufferedReader(new FileReader(args[0]));
		HashSet<String> nouns = new HashSet<String>();
		for(int i=0;i<args.length;++i)
		{nouns.add(args[i]);}
		String line;
		double words = 0.0;
		double nos = 0.0;
		while((line = input.readLine()) != null)
		{
			String[] ws = line.split("\\s+");
			for(String w : ws)
			{
				++words;
				if(nouns.contains(w.split("\\|")[1]))
				{++nos;}
			}
		}
		System.out.println(nos/words);
		input.close();
	}
}